package lesson5.example4;

import com.sun.tools.attach.VirtualMachine;

public class DynamicAttach {

	// 因为JAVA Agent需要通过在命令行上加上-javaagent来执行，这就提高了组件引入成本，在做公共组件时，使用简单也是要考虑的一个点
	public static void main(String args[]) throws Exception {
		VirtualMachine virtualMachine = VirtualMachine.attach("27467");
		virtualMachine.loadAgent("/media/mazhi/sourcecode/workspace/projectjava5/bytecode-examples/bytecode-example-5-02/target/bytecode-example-5-02-0.0.1-SNAPSHOT-jar-with-dependencies.jar");
	}
}
